home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / gfx / conv / undl_1_2.lha / hpbatch.rexx next >
OS/2 REXX Batch file  |  1993-02-17  |  2KB  |  58 lines

  1. /* Convert all the filenames we are passed using HamLabPlus. It is up to
  2.  * the user to have actually started HamLabPlus, and to have set up all the
  3.  * conversion parameters they want. We just feed it files and save the
  4.  * files with a .iff appended to their names.
  5.  *
  6.  * The only marginal bit is maintaining the output cropping parameters.
  7.  * Unfortunately HamLabPlus clears them every time a new picture is loaded,
  8.  * so we can't leave that entirely to the user.
  9.  */
  10.  
  11.     if (show('P','HAMLAB.1') == 0) then do
  12.         say 'HPBATCH'
  13.         say ''
  14.         say 'Please start HamLabPlus before running this batch file. Remember to set up'
  15.         say 'the conversion parameters you want as well.'
  16.         exit 1
  17.     end
  18.  
  19.     if (show(L,'rexxsupport.library') == 0) then do
  20.         call addlib('rexxsupport.library',0,-30,0)
  21.     end
  22.  
  23.     address 'HAMLAB.1'
  24.     parse arg rest
  25.     do while (1)
  26.         parse var rest name rest
  27.         name = strip(name,'B')
  28.         if (name == '') then leave
  29.  
  30.         'getattr output stem out.'
  31.  
  32.         'open filename 'name' force'
  33.         if (rc ~== 0) then do
  34.             say 'hpbatch: failed to open 'name
  35.             iterate
  36.         end
  37.  
  38.         'getattr input stem in.'
  39.         say name' width = 'in.width', height = 'in.height
  40.  
  41.         if (out.crop.width ~== 0) then do
  42.             'outputcrop width 'out.crop.width' height 'out.crop.height' ul 'out.crop.ulx','out.crop.uly
  43.         end
  44.  
  45.         nname = name
  46.         ext = right(nname,4)
  47.         ext = upper(ext)
  48.         if (ext == '.GIF') then do
  49.             len = length(nname) - 4
  50.             nname = left(nname,len)
  51.         end
  52.         nname = nname || '.iff'
  53.  
  54.         'saveas name 'nname' overwrite'
  55.     end
  56.  
  57.     exit 0
  58.